tools: x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2
authorBen Hutchings <ben@decadent.org.uk>
Tue, 11 Sep 2018 01:38:36 +0000 (02:38 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 15 Mar 2019 02:16:04 +0000 (02:16 +0000)
commitede62cbe77df337e160402bb704a81a1469b2a62
tree7c7d6cac9b6cca7f7c40261e293e865b04906207
parentadeb8c451a18d4bcc795b5bfcf39f5b9a51015ff
tools: x86_energy_perf_policy: Fix "uninitialized variable" warnings at -O2

x86_energy_perf_policy first uses __get_cpuid() to check the maximum
CPUID level and exits if it is too low.  It then assumes that later
calls will succeed (which I think is architecturally guaranteed).  It
also assumes that CPUID works at all (which is not guaranteed on
x86_32).

If optimisations are enabled, gcc warns about potentially
uninitialized variables.  Fix this by adding an exit-on-error after
every call to __get_cpuid() instead of just checking the maximum
level.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name tools-x86_energy_perf_policy-fix-uninitialized-varia.patch
tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c